package cn.elricyu.tt.bean.battle;

import cn.elricyu.tt.bean.NationEnum;
import cn.elricyu.tt.bean.User;

public class Team {
	private String teamid;
	private String teamname;
	private int maxnum;
	private String targetname;
	private int currentnum;
	private String condition;

	public String getTeamid() {
		return teamid;
	}

	public void setTeamid(String teamid) {
		this.teamid = teamid;
	}

	public String getTeamname() {
		return teamname;
	}

	public void setTeamname(String teamname) {
		this.teamname = teamname;
	}

	public int getMaxnum() {
		return maxnum;
	}

	public void setMaxnum(int maxnum) {
		this.maxnum = maxnum;
	}

	public String getTargetname() {
		return targetname;
	}

	public void setTargetname(String targetname) {
		this.targetname = targetname;
	}

	public int getCurrentnum() {
		return currentnum;
	}

	public void setCurrentnum(int currentnum) {
		this.currentnum = currentnum;
	}

	public String getCondition() {
		return condition;
	}

	public void setCondition(String condition) {
		this.condition = condition;
	}

	public String getNumDesc() {
		return currentnum + "/" + maxnum;
	}

	public boolean canJoin(User user) {
		return canJoin(user, 0);
	}

	public boolean canJoin(User user, int num) {
		NationEnum nationEnum = NationEnum.typeOf(user.getNation());
		if (!condition.contains(nationEnum.getName())) {
			return false;
		}
		if (currentnum < maxnum && currentnum >= num) {
			return true;
		}
		return false;
	}
}
